package com.erlinyou.im.model.chat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

import com.erlinyou.im.model.base.AbstractDO;

/**
 * 最近会话
 * @author Administrator
 *
 */
@Entity
@Table(name = "tchat_session")
@IdClass(ChatSessionKey.class)
public class ChatSession extends AbstractDO{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	/**
	 * 用户ID
	 */
	@Id
	private Long userid;
	/**
	 * 对方id
	 */
	@Id
	private Long rid;
	/**
	 * 更新时间
	 */
	private Long uptime;
	/**
	 * 消息类型
	 * 1	单聊
	 * 2	群聊
	 */
	@Id
	private int ctype;
	/**
	 * 消息内容
	 */
	@Column(columnDefinition="text")
	private String content;
	/**
	 * 未读数
	 */
	private int noreadnum;
	
	
	public ChatSession(){}
	public ChatSession(Long userid, Long rid, Long uptime, int ctype, String content, int noreadnum) {
		super();
		this.userid = userid;
		this.rid = rid;
		this.uptime = uptime;
		this.ctype = ctype;
		this.content = content;
		this.noreadnum = noreadnum;
	}
	public Long getUserid() {
		return userid;
	}
	public void setUserid(Long userid) {
		this.userid = userid;
	}
	public Long getRid() {
		return rid;
	}
	public void setRid(Long rid) {
		this.rid = rid;
	}
	public Long getUptime() {
		return uptime;
	}
	public void setUptime(Long uptime) {
		this.uptime = uptime;
	}
	public int getCtype() {
		return ctype;
	}
	public void setCtype(int ctype) {
		this.ctype = ctype;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public int getNoreadnum() {
		return noreadnum;
	}
	public void setNoreadnum(int noreadnum) {
		this.noreadnum = noreadnum;
	}
	
	public ChatSession copy(){
		return new ChatSession(userid, rid, uptime, ctype, content, noreadnum);
	}
}
